package com.xxgc.demo.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/***
 * 配置虚拟路径映射
 */
@Configuration
public class VirtualPathConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //服务器地址
        String systemPath = "file:C:/uploadImg/";
        //虚拟地址 /images
        registry.addResourceHandler("/images/**").addResourceLocations(systemPath);
    }
}
